﻿@model EventCreator

@section styles{
    @Styles.Render("~/Content/bootstrap-select.css")
    @Styles.Render("~/Content/daterangepicker-bs3.css")
}

@{
    string title = ViewBag.Title;
    string returnListUrl = ViewBag.ReturnListUrl;
    SelectList categoryDDL = ViewBag.CategoryDDL;
    
    string controller = "event";

    ViewBag.Title = "Tạo mới " + title;
}

<section class="content-header">
    <h1>
        @title.ToUpper() <small>tạo mới</small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="@Url.Action("Index", "Admin")">
                <i class="fa fa-home"></i> Trang chủ
            </a>
        </li>
        <li>
            <a href="@Url.Action("Index")">Danh sách @title</a>
        </li>
        <li class="active">Tạo mới</li>
    </ol>
</section>

<section class="content">
    @using (Html.BeginForm("Create", "Event", FormMethod.Post, new { id = "frmCreateEvent", enctype = "multipart/form-data" }))
    {
        @Html.AntiForgeryToken()
        @Html.Hidden("ReturnListUrl", returnListUrl);

        <div class="box box-primary">
            <div class="box-body">
                <div class="row">
                    <div class="col-md-5">
                        <div class="form-group">
                            <label class="control-label">Thuộc nhóm</label>
                            @Html.DropDownListFor(m => m.CategoryId, categoryDDL, "Chọn danh mục",
                            new
                            {
                                @class = "selectpicker no-margin",
                                data_width = "100%",
                                data_size = "auto",
                                data_live_search = "true"
                            })
                            @Html.ValidationMessageFor(m => m.CategoryId, "", new { @class = "text-danger" })
                        </div>
                        <div class="form-group">
                            <label class="control-label">Tên sự kiện</label>
                            @Html.TextAreaFor(m => m.Name, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Name, "", new { @class = "text-danger" })
                        </div>
                        <div class="form-group">
                            <label class="control-label">Thời gian diễn ra</label>
                            @Html.TextBoxFor(m => m.Deadline, new { @class = "form-control", @readonly = "readonly", style = "cursor: pointer" })
                            @Html.ValidationMessageFor(m => m.Deadline, "", new { @class = "text-danger" })
                        </div>
                        <div class="form-group">
                            <label class="control-label">Ảnh đại diện</label>
                            <input name="Image" type="file" class="form-control" accept="image/*">
                            @Html.ValidationMessageFor(m => m.Image, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <div class="col-md-7">
                        <div class="form-group">
                            <label class="control-label">Mô tả</label>
                            @Html.TextAreaFor(m => m.Description, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Description, "", new { @class = "text-danger" })
                        </div>
                    </div>
                </div>
            </div>
            <div class="box-footer text-right">
                <a href="@Request.UrlReferrer" class="btn btn-default pull-left">
                    <i class="fa fa-chevron-left"></i> Quay lại
                </a>
                <button type="reset" class="btn btn-warning">
                    <i class="fa fa-repeat"></i> Mặc định
                </button>
                <button type="submit" class="btn btn-success">
                    <i class="fa fa-check"></i> Xác nhận
                </button>
            </div>
        </div>
    }
</section>

@section scripts{
    @Scripts.Render("~/Scripts/bootstrap-select.js")
    @Scripts.Render("~/Scripts/daterangepicker/daterangepicker.js")
    @Scripts.Render("~/Scripts/daterangepicker/moment.js")
    <script>
        $('.selectpicker').selectpicker();

        ActiveMenu('@controller');

        $('#Deadline').daterangepicker({
            timePicker: true,
            format: 'DD/MM/YYYY hh:mm A',
            locale: {
                applyLabel: 'Xác nhận',
                cancelLabel: 'Đóng',
                fromLabel: 'Từ',
                toLabel: 'Đến',
            }
        });

        $('#frmCreateEvent').data("validator").settings.ignore = "";
    </script>
    @Scripts.Render("~/Scripts/ckeditor/ckeditor.js")
    <script>
        CKEDITOR.replace('Description');
    </script>
}